$(function () {

   //热门文章
   $.ajax({
        url:"/blog/rightList",
        type:"post",
        data:{flag:0},
        success:function(data){
            var l = '';
            $.each(data,function(index,item){
                l += '<li class="list-group-item">\n' +
                    '            <span class="badge">'+item.viewcount+'</span>\n' +
                    '            <a href="/blog/detail/'+item.id+'">'+item.title+'</a>\n' +
                    '        </li>';
            })
            $('#hotBlog').append(l);
        }
    });
//最新文章
    $.ajax({
        url:"/blog/rightList",
        type:"post",
        data:{flag:1},
        success:function(data){
            var l = '';
            $.each(data,function(index,item){
                l += '<li class="list-group-item">\n' +
                    '            <span class="badge">'+item.viewcount+'</span>\n' +
                    '            <a href="/blog/detail/'+item.id+'">'+item.title+'</a>\n' +
                    '        </li>';
            })
            $('#newBlog').append(l);
        }
    });
})
